package aiku.numericalcontroloa.Controller.OrderManagement;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.OrderManagement.OrderBillingDto;
import aiku.numericalcontroloa.Model.Dto.OrderManagement.OrderDto;
import aiku.numericalcontroloa.Model.Dto.OrderManagement.RoyaltyDto;
import aiku.numericalcontroloa.Model.Dto.PageSelect;
import aiku.numericalcontroloa.Model.Entity.Current;
import aiku.numericalcontroloa.Model.Entity.Devices;
import aiku.numericalcontroloa.Model.Entity.OrderManagement.OrderBilling;
import aiku.numericalcontroloa.Service.OrderManagement.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单管理控制层
 * @Author 黄广庭
 * @Date 2024/3/13 17:51
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderCont {
    private final OrderService orderService;

    public OrderCont(OrderService orderService) {
        this.orderService = orderService;
    }

    /**
     * 添加订单
     * @param orderDto
     * @return
     */
    @PostMapping("/addOrder")
    public Result addOrder(@RequestBody OrderDto orderDto){
        return orderService.addOrder(orderDto);
    }

    /**
     * 根据id删除订单
     * @param orderDto
     * @return
     */
    @PostMapping("/deleteOrder")
    public Result deleteOrder(@RequestBody OrderDto orderDto){
        return orderService.deleteOrder(orderDto);
    }

    /**
     * 修改订单
     * @param orderDto
     * @return
     */
    @PostMapping("/updateOrder")
    public Result updateOrder(@RequestBody OrderDto orderDto){
        return orderService.updateOrder(orderDto);
    }

    /**
     * 修改订单状态
     * @param orderDto
     * @return
     */
    @PostMapping("/updateOrderStatus")
    public Result updateOrderStatus(@RequestBody OrderDto orderDto){
        return orderService.updateOrderStatus(orderDto);
    }

    /**
     * 获取订单列表
     * @param orderDto
     * @return
     */
    @PostMapping("/getOrderList")
    public Result getOrderList(@RequestBody OrderDto orderDto){
        return orderService.getOrderList(orderDto);
    }

    /**
     * 获取订单详情
     * @param orderDto
     * @return
     */
    @PostMapping("/getOrder")
    public Result getOrder(@RequestBody OrderDto orderDto) {
        return orderService.getOrder(orderDto);
    }

    /**
     * 订单交付，上传验收单，物流信息，签订合同/开销单
     * @param orderDto
     * @return
     */
    @PostMapping("/orderDelivery")
    public Result orderDelivery(@RequestBody OrderDto orderDto){
        return orderService.orderDelivery(orderDto);
    }

    /**
     * 下单通过
     * @param orderDto
     * @return
     */
    @PostMapping("/orderExamine")
    public Result orderExamine(@RequestBody OrderDto orderDto){
        return orderService.orderExamine(orderDto);
    }

    /**
     * 收款申请
     * @param orderBilling
     * @return
     */
    @PostMapping("/application")
    public Result application(@RequestBody OrderBilling orderBilling){
        return orderService.application(orderBilling);
    }

    /**
     * 获取订单账单列表
     * @param orderBillingDto
     * @return
     */
    @PostMapping("/getOrderBillingList")
    public Result getOrderBillingList(@RequestBody OrderBillingDto orderBillingDto){
        return orderService.getOrderBillingList(orderBillingDto);
    }

    /**
     * 收款审核
     * @param orderDto
     * @return
     */
    @PostMapping("/collectionAudit")
    public Result collectionAudit(@RequestBody OrderDto orderDto){
        return orderService.collectionAudit(orderDto);
    }

    /**
     * 更换业务员
     * @param orderDto
     * @return
     */
    @PostMapping("/changeSalesman")
    public Result changeSalesman(@RequestBody OrderDto orderDto){
        return orderService.changeSalesman(orderDto);
    }

    /**
     * 更换售后员
     * @param orderDto
     * @return
     */
    @PostMapping("/changeAfterSale")
    public Result changeAfterSale(@RequestBody OrderDto orderDto){
        return orderService.changeAfterSale(orderDto);
    }

    /**
     * 业务员，售后员提成
     * @return
     */
    @PostMapping("/orderRoyalty")
    public Result orderRoyalty(@RequestBody RoyaltyDto royaltyDto){
        return orderService.orderRoyalty(royaltyDto);
    }

    /**
     * 获取提醒天数
     * @return
     */
    @PostMapping("/getReminderDays")
    public Result getReminderDays(){
        return orderService.getReminderDays();
    }

    /**
     * 修改提醒天数
     * @param current
     * @return
     */
    @PostMapping("/updateReminderDays")
    public Result updateReminderDays(@RequestBody Current current){
        return orderService.updateReminderDays(current);
    }
}
